#define _CRT_SECURE_NO_WARNINGS

//https://leetcode.cn/problems/first-unique-character-in-a-string/description/

#include<istream>
using namespace std;

class Solution {
public:
    static int firstUniqChar(string s) {
        int count[26] = { 0 };
        for (char n : s)
        {
            ++count[n - 'a'];
        }
        for (int i = 0; i < 24; i++)
        {
            if (count[s[i] - 'a'] == 1)
                return i;
        }
        return -1;
    }
};
int main()
{
    Solution::firstUniqChar("z");
}